#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int num1,num2,num3;
	int a[5500];
	int b[5500];
	int c[5500];
	int n;
	num1 = num2 = num3 = 0;
	cin>>n;
	for(int i = 1;i<=n;i++)
	{
		int x;
		cin>>x;
		if(x==1) a[num1++] = i;
		else if(x==2) b[num2++] = i;
		else c[num3++] = i;
	}
	int ans = min(num1,num2);
	ans = min(ans,num3);
	cout<<ans<<endl;
	for(int i = 0;i<ans;i++)
	{
		cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<endl;
	}
}
